找传奇、传世资源到传世资源站!

delphi 7 联接oracle9 源码

8.5玩家评分(1人评分)
下载后可评
介绍 评论 失效链接反馈

【例子介绍】

delphi 7 联接oracle9 源码

【相关图片】delphi 7 联接oracle9 源码 Delphi数据库编程-第1张

【源码结构】

procedure TForm1.Button1Click(Sender: TObject);
var
  sqlstr: string;
  sqlstr2: string;
  i, j: Integer;
  k: Integer;
begin
  try
    OraSession1.Options.Net := True;
    OraSession1.Username := trim(user_Global);
    OraSession1.Password := trim(password_Global);
    OraSession1.Server := trim(server_Global);
    OraSession1.Connect;
  except
    barMessage.Panels[1].Text := '       断开';
    exit;
  end;

  barMessage.Panels[1].Text := '       正常';

 {
  DISTINCT train as 车次,id as 工号,name as 姓名,room as 房间,actin as 入寓时间,'
    'actout as 出寓时间,seat as 床位,worksite as 地点 '
    '
 }

  sqlstr := ' select  room,name from s_standbytime  where  nvl2(actout,0,1)=1   '
    '    and  worksite = ' QuotedStr(caption_Global)
    ' and dat between to_date('
    QuotedStr(DateToStr(Date() - 1)) ',' QuotedStr('yyyy-mm-dd') ') and to_date('
    QuotedStr(DateToStr(Date())) ',' QuotedStr('yyyy-mm-dd') ') order by room,seat';
  OraQuery1.sql.clear;
  OraQuery1.sql.add(sqlstr);
  OraQuery1.Active := True;

  sqlstr2 := 'select DISTINCT room from S_room  where worksite= ' QuotedStr(caption_Global);
  OraQuery2.sql.clear;
  OraQuery2.sql.add(sqlstr2);
  OraQuery2.Active := True;

  if (h_int = 8) and (OraQuery2.RecordCount <> 8) then begin
    h_int := OraQuery2.RecordCount div 5 1;
    Timer_h.Enabled := True;
  end;

  for i := 0 to ComponentCount - 1 do
  begin
    if Components[i] is TStaticText then
      if TStaticText(Components[i]).Caption = 'StaticText1' then
        TStaticText(Components[i]).Caption := '';

    if Components[i] is TLabel then
      TLabel(Components[i]).Caption := '';

    if Components[i] is TPanel then
      if TPanel(Components[i]).Color <> clSkyBlue then
        TPanel(Components[i]).Color := clLime;
  end;

  OraQuery2.First;
  k := 1;
  while not OraQuery2.Eof do begin
    for i := 0 to ComponentCount - 1 do
    begin

      if Components[i] is TStaticText then
      begin
        if TStaticText(Components[i]).Parent.Tag = k then begin
          if TStaticText(Components[i]).Caption = '' then begin
            TStaticText(Components[i]).Caption := trim(OraQuery2.FieldList[0].AsString);
            TStaticText(Components[i]).Tag := k;
            TStaticText(Components[i]).Font.Color := clBlack;
            TStaticText(Components[i]).Font.Style := [fsBold];
            TStaticText(Components[i]).Font.Name := '隶书';
            TStaticText(Components[i]).Font.Size := 42;
            TStaticText(Components[i]).Alignment := taLeftJustify;
            TStaticText(Components[i]).Left := 15;
            TStaticText(Components[i]).top := 15;
            TStaticText(Components[i]).AutoSize := True;
          end;
        end;
      end;

      if Components[i] is TLabel then
      begin
        if TLabel(Components[i]).Parent.Tag = k then begin
          TLabel(Components[i]).Tag := k;
          TLabel(Components[i]).Caption := '';

          TLabel(Components[i]).Font.Color := clBlack;
          TLabel(Components[i]).Font.Style := [];
          TLabel(Components[i]).Font.Size := 18;
          TLabel(Components[i]).Left := TStaticText(Components[i]).Parent.Width div 2;
          TLabel(Components[i]).top := TStaticText(Components[i]).Parent.Height div 3;
          TLabel(Components[i]).AutoSize := True;
        end; end;

    end;
    k := k 1;
    OraQuery2.Next;
  end;

  OraQuery1.First;
  while not OraQuery1.Eof do begin
    for i := 0 to ComponentCount - 1 do
    begin
      k := 0;
      if Components[i] is TStaticText then begin
        if TStaticText(Components[i]).Caption = trim(OraQuery1.FieldList[0].AsString) then begin
          k := TStaticText(Components[i]).Tag;
        end;
      end;

      for j := 0 to ComponentCount - 1 do
      begin
        if Components[j] is TLabel then
        begin
          if (TLabel(Components[j]).Tag = k) and (k > 0) then
            if TLabel(Components[j]).Caption <> trim(OraQuery1.FieldList[1].AsString) then
              if TLabel(Components[j]).Caption = '' then
                TLabel(Components[j]).Caption := trim(OraQuery1.FieldList[1].AsString)
              else
                TLabel(Components[j]).Caption := TLabel(Components[j]).Caption #13 trim(OraQuery1.FieldList[1].AsString);
        end;

        if Components[j] is TPanel then
        begin
          if (TPanel(Components[j]).Tag = k) and (k > 0) then
            TPanel(Components[j]).Color := clFuchsia;
        end;
      end;

    end;
    OraQuery1.Next;
  end;

end;

评论

发表评论必须先登陆, 您可以 登陆 或者 注册新账号 !


在线咨询: 问题反馈
客服QQ:174666394

有问题请留言,看到后及时答复